<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../../vue/vue.js"></script>
</head>

<body>
    <div id="app">
        <p v-model="tel">{{tel|hidden}}</p>
    </div>
    <script type="text/javascript">
        new Vue({
            el: '#app',
            data: {
                tel: "13324558785"
            },
            filters:{
                hidden(str){
                    if (null != str && str != undefined) {
        		var pat = /(\d{3})\d*(\d{4})/;//正则表达式
                //\d代表0-9
                //\d{4} 4位数字
                //[^\d]一位非数字
                //\d{1,2}　一到两位数字
        		return str.replace(pat, '$1****$2');
      		} else {
		        return '';

                }
            }
        }
        })

    </script>



</body>



</html>